public class Solution3 {
    public int countSegments(String s) {
        int len = s.length();
        if(len==0)
            return 0;

        int count = 0;
        String ss[]= s.split(" ");
        for(String r:ss){
            if(r.length()!=0)
                count++;
        }
        return count;
    }
}
